/*
 * mox_storage.h
 *
 *  Created on: Jun 9, 2010
 *      Author: Jason Monk
 */

#ifndef MOX_STORAGE_H_
#define MOX_STORAGE_H_

typedef unsigned mox_sh;

#include "mox_module.h"

#define MAX_STORAGE 5

/*
typedef enum {
	STORAGE_MSG=0x500,
	STORAGE_NONE,
	STORAGE_FREE,
	STORAGE_BUSY,
	STORAGE_LOCK,
	STORAGE_UNLK,
	STORAGE_READ,
	STORAGE_WRTE,
	STORAGE_WAIT,
	STORAGE_NACK,
	STORAGE_ACK,
	STORAGE_CLR
} str_msg_t;
*/

#ifndef __XC__
#include <xccompat.h>

struct mox_storage {
	int num;
	struct mox_module **mod;
	int *prog_addr;
};


int  all_storage_free(struct mox_storage *storage);
int  storage_free(struct mox_module *mod);
int  lock_all_storage(struct mox_storage *storage);
int  unlock_all_storage(struct mox_storage *storage);
int *read_storage(struct mox_module *mod, int addr, int n);
int  write_storage(struct mox_module *mod, int addr, int n, void *data);
int  lock_storage(struct mox_module *mod);
int  unlock_storage(struct mox_module *mod);
int  clear_storage(struct mox_module *mod, int *addr, int n);

#endif

#endif //MOX_STORAGE_H_
